package MyqueueStack;
import java.util.*;
class MyQueue {
    Stack stack1 = new Stack<Integer>();
    Stack stack2 = new Stack<Integer>();

    public void push(int x) {
        stack1.push(x);
    }

    public int pop() {
        if(stack2.isEmpty()) {
            while(stack1.size() != 0) {
                stack2.push(stack1.pop());
            }
        }
        return (int)stack2.pop();
    }

    public int peek() {
        if(stack2.isEmpty()) {
            while(stack1.size() != 0) {
                stack2.push(stack1.pop());
            }
        }

        return (int)stack2.peek();
    }

    public boolean empty() {
        return stack1.empty() && stack2.empty();
    }
}
